package Logic;

/**
 * Created by qq65827 on 2015/2/1.
 */
public class selectSort {

    public static void select(int[] a) {
        for (int i = 0; i < a.length; i++) {
            int min = a[i];
            int flag = i;
            for (int j = i; j < a.length; j++) {
                if (a[j] < min) {
                    min = a[j];
                    flag = j;
                }
            }
            if (min != a[i]) {
                int temp = a[flag];
                a[flag] = a[i];
                a[i] = temp;
            }
        }
    }
}
